hotplug/Linux: Fix locking in tools/hotplug/Linux/locking.sh
authorJacek Konieczny <jajcus@jajcus.net>
Wed, 14 Nov 2012 10:24:28 +0000 (10:24 +0000)
committerJacek Konieczny <jajcus@jajcus.net>
Wed, 14 Nov 2012 10:24:28 +0000 (10:24 +0000)
The claim_lock() function would fail in the perl code with:

  Invalid argument at -e line 2.

because the Perl snippet opens for reading the file descriptor, which
was earlier opened for write (append).

Signed-off-by: Jacek Konieczny <jajcus@jajcus.net>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Committed-by: Ian Campbell <ian.campbell@citrix.com>
tools/hotplug/Linux/locking.sh

index e34f155438ae9c1fdf97bd0d0beef5b5f049ca57..122bcfb53bbba8181785230f8e56a3e508a17741 100644 (file)
@@ -44,7 +44,7 @@ claim_lock()
     # See below for a correctness proof.
     local rightfile
     while true; do
-        eval "exec $_lockfd>>$_lockfile"
+        eval "exec $_lockfd<>$_lockfile"
         flock -x $_lockfd || return $?
         # We can't just stat /dev/stdin or /proc/self/fd/$_lockfd or
         # use bash's test -ef because those all go through what is